package com.example.flutterandroid;

import android.app.Application;

import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.embedding.engine.FlutterEngineCache;
import io.flutter.embedding.engine.dart.DartExecutor;

public class TheApp extends Application {
    public FlutterEngine flutterEngine;
    @Override
    public void onCreate() {
        super.onCreate();
        flutterEngine = new FlutterEngine(this);

        flutterEngine.getDartExecutor().executeDartEntrypoint(
                DartExecutor.DartEntrypoint.createDefault()
        );

        FlutterEngineCache
                .getInstance()
                .put("my_engine_id", flutterEngine);
    }

    @Override
    public void onTerminate() {
        super.onTerminate();
        flutterEngine.destroy();
    }
}
